package gewu.suleju.controller;

import gewu.suleju.model.pojo.BrokerInfo;
import gewu.suleju.model.pojo.CompanyInformation;
import gewu.suleju.model.vo.Result;
import gewu.suleju.sevice.imp.CompanyInforSreviceImp;
import gewu.suleju.sevice.imp.PersonInforServiceImp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("manager")
public class CompanyController {
    @Autowired
    CompanyInforSreviceImp companyInforSreviceImp;

    @Autowired
    PersonInforServiceImp personInforServiceImp;

    //查找公司信息
    @ResponseBody
    @GetMapping("company")
    public Result company(String brokerid) {
        int brokerId=Integer.parseInt(brokerid);
        CompanyInformation companyInformation=companyInforSreviceImp.findCompanyInformationByBrokerInfoId(brokerId);
        return new Result("200","查找公司成功",companyInformation);
    }

    //查找个人资料
    @ResponseBody
    @GetMapping("personalnfor")
    public Result  brokerPersonal(String brokerid) {
        int brokerId=Integer.parseInt(brokerid);
        BrokerInfo broker=personInforServiceImp.findBrokerById(brokerId);
        System.out.println(broker);
        return new Result("200","查找个人资料成功",broker);
    }
}
